#!/usr/bin/ruby -w 
#This program checks if the spillover is reported by analyze.rb 
#If spillover has occured, then it sends an email notification to admin and experimenter
#by calling a system command sendEmail
#
#Author: Bhushan Kotnis, Dipti Vete  (mailto: bhushan.kotnis@gmail.com,dvete@eden.rutgers.edu)
#
##License::Distributes under the same terms as ruby

begin

require "analyze"

class Notification < Analyze

 if (notify.flag == 1)

    system("sendEmail -f bh_2k@hotmail.com -t 'Bhushan<bhushan.kotnis@gmail.com> ' -bcc -u Spillover -m Dear Experimenter, A Packet Spillover has been detected in your expereiment. Please contact Admin for further details. -s localhost")
    system("notification.txt | /usr/sbin/sendmail -t -bm -v")
 end

end

end

